package com.shengsheng.expschedule.service.expschedule.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shengsheng.expschedule.service.expschedule.entity.Section;
import com.shengsheng.expschedule.service.expschedule.mapper.SectionMapper;
import com.shengsheng.expschedule.service.expschedule.service.SectionService;
import com.shengsheng.expschedule.service.expschedule.util.TimeTableProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 课程节次表 服务实现类
 * </p>
 *
 * @author yuan
 * @since 2021-09-30
 */
@Service
public class SectionServiceImpl extends ServiceImpl<SectionMapper, Section> implements SectionService {

    @Autowired
    private TimeTableProperties timeTableProperties;
    @Override
    public List<Section> getSectionByBatchType(Integer batchType) {

        QueryWrapper<Section> sectionQueryWrapper = new QueryWrapper<>();
        sectionQueryWrapper.eq("season_type", timeTableProperties.getType())
                .eq("batch_type", batchType)
                .orderByAsc("time");
        return baseMapper.selectList(sectionQueryWrapper);
    }
}
